<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>

<s:layout-render name="/layout_template.jsp" nadpis="vehicle.mainHeading">
    <s:layout-component name="telo">
        <s:useActionBean beanclass="cz.muni.fi.pa165.carparkweb.actionbeans.VehicleActionBean" var="actionBean"/>
        <h2><f:message key="vehicle.allHeading"/></h2>       
        <%@include file="/WEB-INF/jsp/vehicleMenu.jsp"%> 
        <table id="basicview">
            <thead>
                <tr>
                    <th><f:message key="id"/></th>
                    <th><f:message key="vehicle.licencePlate"/></th>
                    <th><f:message key="vehicle.description"/></th>                    
                    <th><f:message key="vehicle.status"/></th>
                    <th/>
                    <th/>
                    <th/>
                </tr>
            </thead>            
            <tbody>
                <c:forEach items="${actionBean.vehicles}" var="vehicle">
                    <tr>                 
                        <td>${vehicle.id}</td>
                        <td><c:out value="${vehicle.stateLicencePlate}"/></td>
                        <td><c:out value="${vehicle.carProducer} ${vehicle.carModel} ${vehicle.engineType}"/></td>  
                        <td><f:message key="VehicleStatus.${vehicle.status}" /></td>
                        <td><s:link beanclass="cz.muni.fi.pa165.carparkweb.actionbeans.VehicleActionBean" event="delete"><s:param name="vehicle.id" value="${vehicle.id}"/><f:message key="delete"/></s:link> </td>
                        <td><s:link beanclass="cz.muni.fi.pa165.carparkweb.actionbeans.VehicleActionBean" event="edit"><s:param name="vehicle.id" value="${vehicle.id}"/><f:message key="edit"/></s:link> </td>
                        <td><s:link beanclass="cz.muni.fi.pa165.carparkweb.actionbeans.VehicleActionBean" event="details"><s:param name="vehicle.id" value="${vehicle.id}"/><f:message key="showDetails"/></s:link> </td>

                    </tr>
                </c:forEach>
            </tbody>            
        </table>     
    </s:layout-component>

</s:layout-render>